package test;

/**
 * @author 龙小虬
 * @date 2021/4/24 23:37
 */
public class ThreadTest2 {
    static class ThreadA extends Thread{

        private Task mTask;

        public ThreadA(Task tk){
            mTask = tk;
        }

        public void run() {
            mTask.doLongTimeTaskC();
        }
    }

    static class ThreadB extends Thread{

        private Task mTask;

        public ThreadB(Task tk){
            mTask = tk;
        }

        public void run() {
            mTask.doLongTimeTaskC();
        }
    }

    public static void main(String[] args) {
        ThreadA ta = new ThreadA(new Task());
        ThreadB tb = new ThreadB(new Task());

        ta.setName("A");
        tb.setName("B");

        ta.start();
        tb.start();

    }
}
